<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .big-box{
            width: 300px;
            height: 300px;
            background: red
        }
        .smallbiox{
            width: 100px;
            height: 100px;
            background: beige
        }
    </style>
</head>
<body>
    <ul id="check">
        <li v-for="(item,index) in list" @click="checkone(index)">
            <input type="checkbox" v-model="item.choose">{{item.name}}
        </li>
    <input type="checkbox" v-model="checkAll" @click="allFun">全选


    <div>
        <span @click="status = 'html'">html</span>
        <span @click="status = 'js'">js</span>
        <span @click="status = 'css'">css</span>
        <ul>
            <li v-show="status === 'html'">html内容</li>
            <li v-show="status === 'js'">js内容</li>
            <li v-show="status === 'css'">css内容</li>
        </ul>
    </div>

    <li @click="show = !show">主页面</li>
    <li v-show="show === true">子页面</li>

    <form>
        <div>
            姓名: <input type="text" placeholder="请输入姓名" v-model.trim.lazy="obj.userName">
        </div>
        <div>
            年龄: <input type="text" placeholder="请输入年龄" v-model.number="obj.age">
        </div>
        <div>
            性别：
            <input value="男" type="radio" name="gender" v-model="obj.gender">男   
            <input value="女" type="radio" name="gender" v-model="obj.gender">女
        </div>
        <select  v-model="obj.address">
            <option disabled selected>请选择</option>
            <option v-for="item in address">{{item}}</option>
        </select>
        <div>
            <span>爱好：</span>
            <ul v-for="item in checkboxArr">
                <input type="checkbox" :value="item" v-model="obj.like">{{item}}
            </ul>
        </div>
        <div>
            建议：
            <textarea name="" id="" cols="30" rows="10"  v-model="obj.area"></textarea>
        </div>
        {{obj}}
        <br>
        <button @click="clickFun">提交</button>
    </form>


    <div class="big-box" @click.prevent="clickFn">
        <div class="smallbiox" @click.stop="clickFn"></div>
    </div>

    </ul>
</body>
<script src="./vue.js"></script>
<script>
    let vm = new Vue({
        el:"#check",
        data:{
            checkboxArr:['打游戏','吃鸡','DNF','联盟','王者','农药','飞车'],
            address:['山西','山东','陕西','河南','河北','苏州'],
            checkAll:false,
            status:"html",
            show:"true",
            obj:{
                userName:"",
                gender:"",
                age:"",
                address:"请选择",
                like:[],
                area:""
            },
            list:[
                {
                    name:"阿凡达",
                    price:20,
                    choose:true
                },
                {
                    name:"qwe",
                    price:20,
                    choose:false
                },
                {
                    name:"asdf",
                    price:20,
                    choose:false
                },
                {
                    name:"zcv",
                    price:20,
                    choose:false
                },
                {
                    name:"wdf",
                    price:20,
                    choose:false
                },
                {
                    name:"tfx",
                    price:20,
                    choose:false
                }
            ]
        },
        methods:{
            allFun(){
                this.checkAll = !this.checkAll;
                this.list.forEach(item => {
                    item.choose = this.checkAll
                })
            },
            checkone(index){
                this.list[index].choose = !this.list[index].choose;
                this.checkAll = this.list.every(item => item.choose)
            },
            clickFun(){
                if(confirm('确定要删除吗')==true){
                    return true;
                }else{
                    return false;
                }
            },
            clickFn(){
                console.log(this)
            }
        }
    })
</script>
</html>